<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<head>
 	<meta http-equiv="Cache-Control" content="no-cache"/>
 	<link rel="stylesheet" type="text/css" href="style.css" />
	<title> Web rezervacije</title>
</head>

<f:view>
  	<h1>Prijavljen korisnik: <h:outputText value="#{users.user.username}" /> </h1>
	<h2>Spisak svih letova</h2>
	
  	<table border="1" width="80%">
	<tr bgcolor="lightgrey"><th width="10%">Redni broj</th><th width="20%">ID leta</th><th width="20%">Vreme polaska</th><th width="20%">Vreme dolaska</th><th width="30%">Polazni aerodrom</th><th width="30%">Odrediste</th></tr>
  	
  	<ui:repeat value="#{flights.allFlights}" var="flight">
  		
  		<tr class="spisakLetovaRow" onclick="location.href='listFlightServlet?listPassenger=#{flight.idLeta}'">
  		<td><h:outputText value="#{flights.allFlights.indexOf(flight)+1}"/></td>
		<td><h:outputText value="#{flight.idLeta}"/></td>
		<td><h:outputText value="#{flight.vremePolaskaString}"/></td>
		<td><h:outputText value="#{flight.vremeDolaskaString}"/></td>
		<td><h:outputText value="#{flight.polaziAerodrom}"/></td>
		<td><h:outputText value="#{flight.odrediste}"/></td>
		</tr>
		  
  	</ui:repeat>
	</table>
	
	<p><a href="add_flight.faces">Dodaj nov let</a></p>
 	<p><h:outputLink value="LogInServlet?logOff=true">Odjava</h:outputLink></p>	
</f:view>

</html>